DateTimeEditors for WinRT
Specifying the Current Time

You can specify the current time of a C1TimeEditor control by setting the C1TimeEditor.Value property in code.

Try to avoid setting the C1TimeEditor.Value property in XAML as a string value. Parsing these values from strings is culture specific. If you set a value with your current culture and a user is using different culture, the user can get XamlParseException when loading your site. The best practice is to set these values from code or via data binding.

In the Designer

Complete the following steps:

  1. Click the C1TimeEditor control once to select it.
  2. In the Properties window, set the C1TimeEditor.Value property to " 07:00:00". The control reflects a time of 7:00:00 a.m.

In XAML

To specify the current time, place Value="07:00:00" to the <DateTimeEditors:C1TimeEditor>tag so that the markup resembles the following:

Markup
Copy Code
<DateTimeEditors:C1TimeEditor Value="07:00:00"/>

The control reflects a time of 7:00:00 a.m.

In Code

Complete the following steps:

  1. Open the MainPage.xaml.cs page.
  2. Place the following code beneath the C1TimeEditor_Loaded event:
Visual Basic
Copy Code
C1TimeEditor1.Value = New TimeSpan(7, 0, 0)

C#
Copy Code
c1TimeEditor1.Value = new TimeSpan(7,0,0);
  1. Run the project and observe that control reflects a time of 7:00:00 a.m.

This Topic Illustrates the Following:

By following the steps in this topic, you have changed the time on the C1TimeEditor control to 7:00:00 a.m. The result will resemble the following:

 

See Also

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback